package ooday04;
import java.util.Timer;
import java.util.TimerTask;
public class TimerDemo {
    public static void main(String[] args) {
        Timer time=new Timer();
        int timers=1000;
        time.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("学习");
            }
        }, timers,timers);














        /*Timer timer=new Timer();
        int interval=5000;
        timer.schedule(new TimerTask() {
            public void run() {//定时干的事情----每1000毫秒自动执行
                System.out.println("学习");
            }
        }, interval, interval);*/
    }
}
